package com.yf.ability.login.wechat.dto.response;


import com.yf.base.api.api.dto.BaseDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * 微信用户信息响应类
 * @author
 * @date 2019-12-26 17:54
 */
@Data
@ApiModel(value="微信用户信息响应类", description="微信用户信息响应类")
public class WxInfoRespDTO extends BaseDTO {

    @ApiModelProperty(value = "会话标识", required=true)
    private String openId;

    @ApiModelProperty(value = "昵称", required=true)
    private String nickName;

    @ApiModelProperty(value = "性别", required=true)
    private Integer sex;

    @ApiModelProperty(value = "省份", required=true)
    private String province;

    @ApiModelProperty(value = "市", required=true)
    private String city;

    @ApiModelProperty(value = "国家", required=true)
    private String country;

    @ApiModelProperty(value = "头像地址", required=true)
    private String headimgurl;

    @ApiModelProperty(value = "头像地址", required=true)
    private String unionid;

    @ApiModelProperty(value = "头像地址", required=true)
    private List<String> privilege;


    /**
     * 获取唯一ID，如果unionId不为空，则优先使用unionId
     * @return
     */
    public String getUqId(){
        if(!StringUtils.isBlank(unionid)){
            return unionid;
        }
        return openId;
    }
}
